@extends('layouts.master')
@section('content')
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox">
                <div class="ibox-content">
                    <form class="layui-form" action="">
                        <div class="layui-inline">
                            <div class="layui-inline">
                                <label class="layui-form-label">关键字:</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="query[keywords]" lay-verify="" placeholder="昵称/手机号"
                                           style="width: 200px;" value="{{$query['keywords']}}" autocomplete="off"
                                           class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">充值时间:</label>
                            <div class="layui-input-inline" style="width: 150px;">
                                <input type="text" class="layui-input  start_time" value="{{$query['start_time']}}"
                                       name="query[start_time]"
                                       readonly>
                            </div>
                            -
                            <div class="layui-input-inline" style="width: 150px;">
                                <input type="text" class="layui-input end_time" value="{{$query['end_time']}}"
                                       name="query[end_time]"
                                       readonly>
                            </div>
                        </div>
                        <div class="layui-inline" style="padding-bottom: 5px">
                            <div class="layui-input-inline">
                                <input type="hidden" name="page_num" value="{{$currentPageNum}}">
                                <button name="submit" class="btn btn-success" type="submit">搜索</button>
                            </div>
                        </div>
                    </form>

                    @include('common.toolbar', ['pager' => $pager])

                    <form class="layui-form form-horizontal" id="ajaxform">
                        <table class="layui-table">
                            <thead>
                            <tr>
                                <th>ID</th>
                                <th>粉丝</th>
                                <th>会员</th>
                                <th>充值</th>
                                <th>充值时间</th>
                                <th>状态</th>
                                <th>备注</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach($pager as $item)
                                <tr>
                                    <td>{{$item->id}}</td>
                                    <td>
                                        <img src="{{$item->user->avatar}}"
                                             class="rounded-circle img-sm img_pop_show"/><br/>
                                        {{$item->user->nickname}}
                                    </td>
                                    <td>
                                        {{$item->user->realname}}<br/>
                                        {{$item->user->mobile}}
                                    </td>
                                    <td>
                                        @if($item->type==1)
                                            充值余额: {{$item->recharge_money}}
                                        @elseif($item->type==2)
                                            充值积分: {{$item->recharge_credit}}
                                        @endif
                                        @if($item->give_credit > 0)
                                            <br/>赠送积分: {{$item->give_credit}}
                                        @endif
                                        @if($item->give_money > 0)
                                            <br/>赠送金额: {{$item->give_money}}
                                        @endif
                                    </td>
                                    <td>{{$item->created_at}}</td>
                                    <td>
                                        @if($item->state==0)
                                            <span class="label label-danger">充值失败</span>
                                        @elseif($item->state==1)
                                            <span class="label label-success">充值成功</span>
                                        @elseif($item->state==2)
                                            <span class="label label-default">已退款</span>
                                        @endif
                                    </td>
                                    <td>{{$item->remark}}</td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                    </form>
                    @include('common.pagination', ['pager' => $pager])
                </div>
            </div>
        </div>
    </div>
@endsection

@section('script')
    <script>
        layui.use(['laydate', 'element', 'form'], function () {
            var laydate = layui.laydate, element = layui.element;
            var form = layui.form;
            var layer = layui.layer;

            //日期时间选择器
            laydate.render({
                elem: '.start_time'
                , type: 'datetime'
            });
            laydate.render({
                elem: '.end_time'
                , type: 'datetime'
            });
        });
    </script>
@endsection